package com.joysuch.wwyt.mh.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.joysuch.wwyt.mh.bean.vo.MhMajorHazardPlanItemVO;
import com.joysuch.wwyt.mh.dto.MhMajorHazardTaskRecordItemDTO;
import com.joysuch.wwyt.mh.entity.MhMajorHazardPlanItem;
import com.joysuch.wwyt.mh.entity.MhMajorHazardTaskRecord;
import com.joysuch.wwyt.mh.entity.MhMajorHazardTaskRecordItem;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author zqw
 * @since 2022-05-24
 */
public interface MhMajorHazardTaskRecordItemService extends IService<MhMajorHazardTaskRecordItem> {

    /**
     * 批量保存recordItem
     *
     * @param id
     * @param itemDtoList
     */
    void batchSaveItem(Long id, List<MhMajorHazardTaskRecordItemDTO> itemDtoList);

    /**
     * 查询历史任务检查项
     *
     * @param taskId
     * @return
     */
    List<MhMajorHazardPlanItemVO> findHistoryTaskItemsByTaskId(Long taskId);

    /**
     * 批量生成逾期记录检查信息
     *
     * @param records
     * @param recordTaskIdMap keey:recordId value taskId
     * @param taskPlanIdMap   key:taskId value planId
     * @param planItemMap     key planId value plamItems
     */
    void batchSaveOverdueRecordItems(List<MhMajorHazardTaskRecord> records, Map<Long, Long> recordTaskIdMap, Map<Long, Long> taskPlanIdMap, Map<Long, List<MhMajorHazardPlanItem>> planItemMap, Date date);

    List<MhMajorHazardTaskRecordItem> findByRecordIdAndResult(Long id, int result);

    /**
     * 根据taskId 获取最后一个记录的items
     *
     * @param taskId
     * @return
     */
    List<MhMajorHazardTaskRecordItem> getItemsByTaskId(Long taskId);
}
